/* Copyright (c) 2014.*/
package au.com.cba.workitem.serviceImpl;

import java.util.logging.Level;
import java.util.logging.Logger;

import au.com.cba.WorkItemThreadPool;
import au.com.cba.workitem.service.WorkItemExecutorService;
import au.com.cba.workitem.service.WorkItemService;


/**
 * The Class WorkItemExecutorServiceImpl.
 * @author Magesh Ravichandran
 */
public class WorkItemExecutorServiceImpl implements WorkItemExecutorService {
	private final static Logger LOGGER = Logger
			.getLogger(WorkItemExecutorServiceImpl.class.getName());
	/** The Constant NUMBER_OF_ITERATION. */
	public static final Integer NUMBER_OF_ITERATION = 10;
	/* (non-Javadoc)
	 * @see au.com.cba.workitem.service.WorkItemExecutorService#executeWorkItem(au.com.cba.workitem.service.WorkItemService, int)
	 */
	public void executeWorkItem(WorkItemService w, int parallelism) {
		
		WorkItemThreadPool pool = new WorkItemThreadPool(parallelism);
		w = new WorkItemServiceImpl();
		for (int i=0;i<NUMBER_OF_ITERATION;i++) {
			pool.addTask(w);
		}

		 LOGGER.log(Level.INFO,"Finished all threads");
		
	}

	
}
